package com.edu.edurealtimepublisher.mapping;

import com.edu.edurealtimepublisher.bean.TrafficChBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 互动域统计
 */
@Mapper
public interface TrafficStatisticsMapper {
    @Select("select \n" +
            "ch channel,\n" +
            "sum(uv_ct) uvCount,\n" +
            "sum(sv_ct) svCount,\n" +
            "sum(pv_ct)/sum(sv_ct) sessionAvgPv,\n" +
            "sum(dur_sum)/sum(sv_ct) sessionAvgDurTime,\n" +
            "sum(uj_ct)/sum(sv_ct) jumpRate\n" +
            "from dws_traffic_vc_ch_ar_is_new_page_view_window\n" +
            "where toYYYYMMDD(stt)=#{date}\n" +
            "group by ch\n")
    List<TrafficChBean> selectChannelTraffic(Integer date);
}
